<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="language" content="en" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/yui/reset.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/tool/tool.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/tool/table1/style.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->getTemplatePath('rc/style.css'); ?>" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>
    <title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>
<body>

<div id="wrap">

    <div id="content">

        <div id="main">

            <div id="breadcrumbs">
                <?php
                    $focusMenu = $this->menus->getMenuByFocus();
                    echo "{$focusMenu->getMenu()} &raquo; {$focusMenu->getMenuItem()} ";
                ?>  
            </div>
            <div class="">
                <?php echo $content; ?>
            </div>
        </div>
        <br style="clear:both;" />

    </div>

</div>


<?php

// 只要有成功訊息, 就當作算是成功
// $successType , 0=未動作 , 1=成功 , 2=不是成功
$successType = 0;
$messages = SessionManager::getTopMessages();
if( $messages ) {
    $successType = 2;
    foreach( $messages as $msg ) {
        if( $msg['type'] == SessionManager::TOP_MESSAGE_SUCCESS ) {
            $successType = 1;
        } 
    }
}

?>
<script type="text/javascript">

    // 傳遞訊息到 opener window
    var responseJsonData = responseJsonData || {};
    responseJsonData.successType = <?php echo $successType; ?>;

    $(document).ready(function() {

        if( opener && opener.app && opener.app.doResultHook ) {
            opener.app.doResultHook( responseJsonData );
        }

    });

</script>



</body>
</html>